/**
 * 
 */
package instant.mail;

import java.io.IOException;

import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;

/**
 * @author qiangli
 *
 */
public class MyMediaPlayer implements AudioPlayer {
	private MediaPlayer player = null;

	public MyMediaPlayer() {
		super();
		player = new MediaPlayer();
	}

	public void prepare() throws IOException, IllegalStateException {
		player.prepare();
	}

	public void release() {
		player.release();
	}

	public void setDataSource(String path) throws IOException,
			IllegalArgumentException, IllegalStateException {
		player.setDataSource(path);
	}

	public void setOnCompletionListener(OnCompletionListener listener) {
		player.setOnCompletionListener(listener);
	}

	public void setOnErrorListener(OnErrorListener listener) {
		player.setOnErrorListener(listener);
	}

	public void start() throws IllegalStateException {
		player.start();
	}

	public void stop() throws IllegalStateException {
		player.stop();
	}
	
}
